package edu.ctbu.ctbujsj.controller;

import edu.ctbu.ctbujsj.dao.StudentRepository;
import edu.ctbu.ctbujsj.domain.Student;
import edu.ctbu.ctbujsj.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class StudentController {
    @Autowired
    private StudentService studentService;
    @RequestMapping(value = "/student/list")
    public String List(ModelMap map){
       List<Student> studentList=studentService.findAll();
       map.addAttribute("student",studentList);
       return  "/student/list";
    }
}
